//
//  UIViewController+LoadStoryBoard.m
//  OC-Example
//
//  Created by apang on 2018/7/31.
//  Copyright © 2018年 apang.men All rights reserved.
//

#import "UIViewController+LoadStoryBoard.h"

@implementation UIViewController (LoadStoryBoard)

+ (instancetype)loadVCFromStoryBoard:(NSString *)storyBoardName bundle:(NSBundle *)bundle identifier:(NSString *)identifier {
    
    if (!bundle) {
        bundle = [NSBundle mainBundle];
    }
    if (!storyBoardName) {
        storyBoardName = @"Main";
    }
    
    if (!identifier) {
        identifier = NSStringFromClass([self class]);
    }
    
    UIStoryboard * storyBoard = [UIStoryboard storyboardWithName:storyBoardName bundle:bundle];
    
    return [storyBoard instantiateViewControllerWithIdentifier:identifier];
}

+ (instancetype)loadVFromeMainStoryBoardWith:(NSString *)identifier {
    
    return [self loadVCFromStoryBoard:nil bundle:nil identifier:identifier];
}

+ (instancetype)loadFromMainStoryBoard {
    
    return [self loadVFromeMainStoryBoardWith:nil];
}
@end
